<?php if(!defined('OCTOMS')){header('HTTP/1.1 403');die('{"error":"forbidden"}');}
/**
 * @package       OctoMS
 * 
 * @copyright     Copyright 2011, Valentino-Jivko Radosavlevici (http://valentino.radosavlevici.com)
 * @license       GPL v3.0 (http://www.gnu.org/licenses/gpl-3.0.txt)
 * 
 * Redistributions of files must retain the above copyright notice.
 * 
 * @since         OctoMS 0.0.1
 */

	/**
	 * Basic ini settings
	 */
	ini_set('register_globals', 0);
	ini_set('session.auto_start', 0);
	ini_set('mbstring.http_input', 'pass');
	ini_set('mbstring.http_output', 'pass');
	ini_set('mbstring.encoding_translation', 0);
	@set_magic_quotes_runtime(false);
	
	/**
	 * Location constants
	 */
	define('DS', DIRECTORY_SEPARATOR);
	define('WS', '/');
	define('CORE', ROOT.DS.'core');
	
	/**
	 * Generic default constant; used for abstractization
	 */
	define('IMPLICIT', 'IMPLICIT');
	
	/**
	 * Allowed Framework languages
	 * 
	 * Comma-separated; no spaces; 
	 * DEFAULT_LANGUAGE must be present;
	 */
	define('LANGUAGES', 'en,ro');
	define('DEFAULT_LANGUAGE', 'en');
	
	/**
	 * Employee types
	 */
	define('OMS_L', 1);		# library
	define('OMS_H', 2);		# helper
	define('OMS_M', 3);		# model
	define('OMS_CL', 4);	# core library
	define('OMS_CH', 5);	# core helper
	
	/**
	 * File extension
	 */
	define('EXT', '.inc');
	
	if(!file_exists(ROOT . DS . APP_FOLDER))die('Invalid application folder "'.APP_FOLDER.'".');
	
	/**
	 * Core configuration path
	 */
	define('CORE_CONFIG', CORE . DS . 'config');
	
	/**
	 * Core helpers path
	 */
	define('CORE_HELP', CORE . DS . 'helpers');
	
	/**
	 * Core libraries path
	 */
	define('CORE_LIB', CORE . DS . 'libraries');
	
	/**
	 * Core error templates path
	 */
	define('CORE_ERR', CORE . DS . 'errors');
	
	/**
	 * WebRoot
	 */
	if (function_exists('get_bloginfo'))
	{
		define('WEBROOT', preg_replace('%^https?://[^/]*(.*)$%','$1',get_bloginfo('template_url')));	
	}
	else 
	{
		define('WEBROOT', str_replace('/functions.php','',$_SERVER['SCRIPT_NAME']));
	}
	
	define('ADMINROOT',preg_replace('/(.*?)wp-content.*/', '$1wp-admin/admin.php', WEBROOT));
	
	/**
	 * Application server path
	 */
	define('APP_ROOT', ROOT . DS . APP_FOLDER);
	
	/**
	 * Application config path
	 */
	define('APP_CONFIG', APP_ROOT . DS . 'config');
	
	/**
	 * Application helpers path
	 */
	define('APP_HELP', APP_ROOT . DS . 'helpers');
	
	/**
	 * Application libraries path
	 */
	define('APP_LIB', APP_ROOT . DS . 'libraries');
	
	/**
	 * Application templates path
	 */
	define('APP_TPL', APP_ROOT . DS . 'template');
	
	/**
	 * Application error templates path
	 */
	define('APP_ERR', APP_ROOT . DS . 'errors');
	
	/**
	 * Stages server path
	 */
	define('STAGES', APP_ROOT . DS . 'stages');
	
	/**
	 * Application web path
	 */
	define('APP_WEBROOT', WEBROOT . WS . APP_FOLDER);
	
	/**
	 * Wizard webroot
	 */
	define('WIZARD', WEBROOT . WS . 'core' . WS . 'wizard' . WS . 'views');
	
	/**
	 * The wizard launches automatically on any page on your website you query with
	 * ?{DEBUG_KEYWORD}:{API_UID}
	 * if the application is in development mode (ENVIRONMENT = 0)
	 * 
	 * You may change this to anything you want for special cases where you use ?debug:{something}
	 * as a _GET key in your application.
	 * Use only letters [a-zA-Z] and numbers [0-9].
	 */
	define('DEBUG_KEYWORD','debug');
	
	/**
	 * The application will log any bug on your websit if you query
	 * ?{BUG_KEYWORD}:{API_UID}={bug description}
	 * and the application is in development mode (ENVIRONMENT = 0)
	 * 
	 * You may change this to anything you want for special cases where you use ?bug:{something}
	 * as a _GET key in your application.
	 * Use only letters [a-zA-Z] and numbers [0-9].
	 */
	define('BUG_KEYWORD', 'bug');
	
	/**
	 * Get the application-specific constants
	 */
	require_once APP_CONFIG . DS . 'constants' . EXT;
	
/* End Of File <constants.inc> */